USE [Monitoring]
GO

--|--------------------------------------------------------------------------------
--| [GetGameRoleByID] - Insert Procedure Script for GameRole
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[GetGameRoleByID]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
  DROP PROCEDURE [dbo].[GetGameRoleByID]
GO

CREATE PROCEDURE [dbo].[GetGameRoleByID]
(
	@ID int
)
AS
	SET NOCOUNT ON

	SELECT
		[ID],
		[Name]
	FROM 
GameRole
	WHERE
		[ID] = @ID
	
GO


--|--------------------------------------------------------------------------------
--| [InsertGameRole] - Insert Procedure Script for GameRole
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[InsertGameRole]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
  DROP PROCEDURE [dbo].[InsertGameRole]
GO

CREATE PROCEDURE [dbo].[InsertGameRole]
(
	@ID int,
	@Name nvarchar(50)
)
AS
	SET NOCOUNT ON

	INSERT INTO [GameRole]
	(
		[ID],
		[Name]
	)
	VALUES
	(
		@ID,
		@Name
	)

	RETURN @@Error
GO

--|--------------------------------------------------------------------------------
--| [UpdateGameRole] - Update Procedure Script for GameRole
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[UpdateGameRole]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
	DROP PROCEDURE [dbo].[UpdateGameRole]
GO

CREATE PROCEDURE [dbo].[UpdateGameRole]
(
	@ID int,
	@Name nvarchar(50)
)
AS
	SET NOCOUNT ON
	
	UPDATE [GameRole]
	SET
		[ID] = @ID,
		[Name] = @Name
	WHERE 
		[ID] = @ID

	RETURN @@Error
GO

--|--------------------------------------------------------------------------------
--| [DeleteGameRole] - Update Procedure Script for GameRole
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[DeleteGameRole]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
	DROP PROCEDURE [dbo].[DeleteGameRole]
GO

CREATE PROCEDURE [dbo].[DeleteGameRole]
(
	@ID int
)
AS
	SET NOCOUNT ON

	DELETE 
	FROM   [GameRole]
	WHERE  
		[ID] = @ID

	RETURN @@Error
GO

